<script type="text/javascript">
	$(document).ready(function(){

		$('#petition').dataTable();
		
		$("a[id^='info_']").click(function() {
			event.preventDefault();

			var numrow = $(this).attr("id");
            numrow = numrow.substr(5);

			$('<div>').dialog2({
				autoOpen: true,
				title: "ข้อมูลฎีกา",
				content: "dlgInfo_peti.php?ppID=" + numrow,
				id: "modal-infoPeti"
			});

		});
	});
</script>
<?php
	//echo "finance.php"
	include("includes/connect.php");

	$db = new myDBS;

	//$where = "petition_id = '$petition_id'";
	$sql ="SELECT tbl_petition.*, pp_check_job.proID, projectName, amount, instalment FROM tbl_petition, pp_check_job WHERE tbl_petition.ppID = pp_check_job.ppID";
	$result = $db->runSQL($sql);


?>
	<table id="petition" class="table table-striped" width="100%" >
		<caption><br></caption>
		<thead>
			<tr>
				<th>#</th>
				<th>เลขที่โครงการ</th>
				<th>ชื่อโครงการ</th>
				<th>งบประมาณ</th>
				<th>ยอดเบิกจ่าย</th>
				<th>งวดที่</th>
				<th>วันที่เบิกฏีกา</th>
				<th>รายละเอียดเพิ่มเติม</th>
				<th>ตรวจรับฏีกา</th>
			</tr>
		</thead>
		<tbody>
			<?php
				$i=0;
				while ( $rows = $db->fetch_object ( $result )){
					$i++;
			?>
			<tr>
				<td><?php echo $i; ?></td>
				<td><a href="index.php?pages=sumPetition&petition_id=<?php echo $rows->petition_id; ?>" target="_blank"><?php echo $rows->proID; ?></a></td>
				<td><?php echo $rows->projectName; ?></td>
				<td><?php echo number_format($rows->amount); ?></td>
				<td><?php echo number_format($rows->inpNet); ?></td>
				<td><?php echo $rows->instalment; ?></td>
				<td><?php echo $rows->date_create; ?></td>
				<td>
					<a href="#" id="info_<?php echo $rows->ppID; ?>"><i class="icon-list"></i>&nbsp;ดู</a>
				</td>
	 			<td>
					<a href="index.php?pages=frmPetition1&ppID=<?php echo $rows->ppID; ?>" data-toggle="tooltip" title="ผ่าน"><i class="icon-ok"></i></a>&nbsp;<a href="#" data-toggle="tooltip" title="ไม่ผ่าน"><i class="icon-remove"></i></a>
				</td>
			</tr>
			<?php
					
				}
			?>

		</tbody>


	</table>
